const path = require('path'),
	webpack = require('webpack'),
	Visualizer = require('webpack-visualizer-plugin');
const vendors = [
	'avalon2',
	'jquery',
	'scriptjs',
	'bluebird',
	'bootstrap',
];

module.exports = {
	output: {
		path: path.join(__dirname, 'public/dll/'),
		filename: '[name].js',
		library: '[name]',
	},
	resolve: {
		modules   : ['node_modules'],
		extensions: ['.js', '.jsx', '.json'],
	},
	entry: {
		vendor: vendors,
	},
	plugins: [
		new webpack.DllPlugin({
			path: path.join(__dirname, 'public/dll/vendors.json'),
			name: '[name]',
			context: '/',
		}),
		new webpack.DefinePlugin({
			'process.env': {
				NODE_ENV: JSON.stringify(process.env.NODE_ENV),
			},
		}),
		new Visualizer({
			filename: './vendors.html',
		}),
	],
};
